import { baseUrl } from './../config/env'

import {fetch,postData,postJson,postPatch,postImg,deleteAjax,patchForm,postFile} from './../config/httpService'

//登录验证
export function loginStatus(body){
	return fetch(baseUrl+'login-status',body)
}


//获得奖品列表
export function fetchAvailable(body){
	return fetch(baseUrl+'web-api/prizes/available',body)
}

// export function fetchAvailable(body){
// 	return fetch('./../../static/available.json')
// }

//创建奖品
export function createNewPrize(body){
	return postJson(baseUrl+'web/prize/create',body)
}

//通过活动id查找奖品详情
export function getPrizeInfo(body){
	return fetch(baseUrl+'web/prize/modify',body)
}

//编辑奖品
export function postEditPrize(body){
	return postJson(baseUrl+'web/prize/modify',body)
}

//删除奖品
export function deletePrize(body){
	return postJson(baseUrl+'web/prize/delete',body)
}
//上传奖品图片
export function uploadPrizeImg(body){
	return postImg(baseUrl+'web/prize/upload',body)
}

//奖品列表
export function prizeList(body){
	return fetch(baseUrl+'web/prize/query',body)
}

//实物入库
export function entityEntry(body){
	return postJson(baseUrl+'web/prize/entry',body)
}

//实物出库
export function entityDelivery(body){
	return postJson(baseUrl+'web/prize/delivery',body)
}

//奖品列表-奖品优惠卷码导入接口
export function importVoucherCode(body){
	return postFile(baseUrl+'web-api/prize/import-voucher-code',body)
}


//兑奖中心
export function prizeCenter(body){
	return fetch(baseUrl+'web/prize/center',body)
}

//兑奖状态修改/核实用户信息
export function submitUserInfo(id,status){
	return fetch(baseUrl+'web/prize/exchange/'+id,status)
}

//活动列表
export function activityList(body){
	return fetch(baseUrl+'web/activity/list',body)
}

//权重
export function psotSetWeight(body){
	return patchForm(baseUrl+'web/activity/weight',body)
}

//删除活动
export function deleteActivity(body){
	return postJson(baseUrl+'web/activity/delete',body)
}

//复制活动
export function copyActivityItem(id){
	return postJson(baseUrl+'web-api/copy/'+id)
}

//根据活动id 获得活动模板
export function fetchActivityId(id){
	return fetch(baseUrl+'web-api/activities/'+id+'/activity-common')
}

//根据活动id 获得活动奖品列表
export function fetchActivityPrize(id){
	return fetch(baseUrl+'web-api/activity-common/'+id+'/prizes')
}

//编辑活动是  删除奖品
export function deleteActivityPrize(body){
	return deleteAjax(baseUrl+'web-api/activity-common/'+body.activityId+'/prizes/'+body.id )
}
//活动列表修改活动状态接口
export function modifyActivityState(body){
	return postJson(baseUrl+'web/activity/edit',body)
}

//活动列表获取活动二维码
export function activityQrcode(body){
	return fetch(baseUrl+'web/activity/qrcode',body)
}



//是否登录
export function isLogin(){
	return fetch('http://admin.testmorefun.chinamcloud.com');
}

//获取所有活动列表接口
export function fetchActivityList(body){
	return fetch(baseUrl+'web/activity/add',body)
}

// export function fetchActivityList(){
// 	return fetch('./../../static/add.json')
// }


//判断是否绑定微信appid
export function isWechatId(){
	return fetch(baseUrl+'web-api/configurations/wechat')
}

// export function isWechatId(){
// 	return fetch('./../../static/wechat.json')
// }


//微信授权
export function postWxAppId(body){
	return postJson(baseUrl+'web-api/configurations/wechat',body)
}


//上传支付证书
export function postUpload(body){
	return postFile(baseUrl+'web-api/wechat/upload/',body)
}


//新建活动保存内容设置
export function activityContent(body){
	return postJson(baseUrl+'web-api/activities/activity-common',body)
}

//新建活动更新奖品列表
export function postPrizeUpdate(id,body){
	return postPatch(baseUrl+'web-api/activity-common/'+id+'/prize',body)
}

//新建活动保存奖品
export function postPrizeNew1(id,body){
	return postJson(baseUrl+'web-api/activity-common/'+id+'/prize',body)
}

//编辑活动保存奖品
export function postPrizeEdit(activityId,prizeId,body){
	return postPatch(baseUrl+'web-api/activity-common/'+activityId+'/prizes/'+prizeId,body)
}

//保存活动拉新设置
export function activityPublishing(id,body){
	return postJson(baseUrl+'web-api/publishing/'+id,body)
}

//活动更新接口
export function activityCommonUpdate(id,body){
	return postPatch(baseUrl+'web-api/activities/'+id+'/activity-common',body)
}

//新增埋点
export function addPosition(body){
	return postJson(baseUrl+'web/activityPoint/add',body)
}

//获得埋点列表
export function getPositionList(body){
	return postJson(baseUrl+'web/activityPoint/list',body)
}


//删除埋点
export function deletePosition(body){
	return postJson(baseUrl+'web/activityPoint/delete',body)
}

//编辑埋点
export function editPosition(body){
	return postJson(baseUrl+'web/activityPoint/edit',body)
}
 /*
  *根据时间段获取分类数据
   param
    -type  分类
    -start_time 开始时间
    -end_time 结束时间
 */
  export function getActiveItemData(body){
	return fetch(baseUrl+'web/activity/dashboard-time', body)
}

//查看可用埋点列表
export function lookOverPostionList(){
	return fetch(baseUrl+'web/activityDelivery/show')
}

//新建投放
export function addPutItem(body){
	return postJson(baseUrl+'web/activityDelivery/add',body)
}

//模板zip
export function templateUpload(body){
	return postFile(baseUrl+'web-api/template-upload',body)
}
//模板上传
export function templateAdd(body){
	return postJson(baseUrl+'web-api/template-add',body)
}

//新建投放 获得活动列表
export function getPutActivityList(body){
	return fetch(baseUrl+'get-lists',body)
}
//投放列表
export function getPutList(body){
	return fetch(baseUrl+'web/activityDelivery/list',body)
}

//投放删除
export function deletePutList(body){
	return fetch(baseUrl+'web/activityDelivery/delete',body)
}

//修改投放状态
export function editPutState(body){
	return postJson(baseUrl+'web/activityDelivery/edit',body)
}

//保存修改投放
export function modifyPut(body){
	return postJson(baseUrl+'web/activityDelivery/modify',body)
}


//根据id获得埋点
export function getActivityDelivery(body){
	return fetch(baseUrl+'web/activityDelivery/editActivityDelivery',body)
}


//新增触发
export function addTrigger(body){
	return postJson(baseUrl+'web/activityTrigger/create',body)
}

//触发编辑数据
export function editActivityTrigger(body){
	return postJson(baseUrl+'web/activityTrigger/editActivityTrigger',body)
}

//触发编辑提交
export function modifyTrigger(body){
	return postJson(baseUrl+'web/activityTrigger/modify',body)
}

//获得触发列表
export function getTriggerList(body){
	return fetch(baseUrl+'web/activityTrigger/list',body)
}

//修改触发状态
export function editTriggerState(body){
	return postJson(baseUrl+'web/activityTrigger/edit',body)
}

//触发删除
export function deleteTrigger(body){
	return postJson(baseUrl+'web/activityTrigger/delete',body)
}


//新建推送
export function addPush(body){
	return postJson(baseUrl+'j-push',body)
}
//口令创建接口
export function postGuessCode(body){
	return postJson(baseUrl+'web-api/activities/guess-code',body)
}
//删除推送记录
export function deletePush(id){
	return deleteAjax(baseUrl+'j-push',id)
}

//推送列表
export function getPushList(body){
	return fetch(baseUrl+'j-push',body)
}

//获取推送设置内容
export function getPushConfig(){
	return fetch(baseUrl+'push')
}

//更新推送设置
export function updatePushConfig(body){
	return postPatch(baseUrl+'push',body)
}



//新增推送设置
export function addPushConfig(body){
	return postJson(baseUrl+'push',body)
}

//根据口令id 获得口令详情
export function getGuessCodeId(id){
	return fetch(baseUrl+'web-api/activity/'+id+'/guess-code')
}

//猜口令编辑奖品
export function editGuessCodePrize(id,body){
	return patchForm(baseUrl+'web-api/activities/'+id+'/guess-code',body)
}
//数据统计顶部接口
export function statisticsTop(body){
	return fetch(baseUrl+'web/activity/dashboard', body)
}
//活动详情报表头部信息
export function dashboardTop(body){
	return fetch(baseUrl+'web/activity/dashboard-static', body)
}
//新增触发
export function addRedPrize(body){
	return postJson(baseUrl+'web/activityTrigger/create',body)
}
//活动统计
export function statisticsList(body){
	return fetch(baseUrl+'web-api/activity/statistics-list', body)
}


//
export function getQuiz(body){
	return fetch(baseUrl+'web/activity/quiz',body)
}


//添加投票分组
export function voteGroup(body){
	return postData(baseUrl+'web/vote/group',body)
}
//添加选项  上传缩略图
export function tmpPloadImg(body){
	return postImg(baseUrl+'tmp/upload',body)
}

//保存投票项
export function voteCandidate(id,body){
	return postJson(baseUrl+'web/vote/candidate?activity_id='+id,body)
}

//删除投票项
export function voteDeleteItem(body){
	return postJson(baseUrl+'web/vote/delete',body)
}

//投票项批量删除
export function voteDeleteAll(body){
	return fetch(baseUrl+'web/vote/delete',body)
}

//投票自定义项上下架
export function shelvesEdit(body){
	return postJson(baseUrl+'web/vote/shelves-edit',body)
}



//投票项列表
export function candidateList(body){
	return fetch(baseUrl+'web/vote/candidate',body)
}

//上传音频视频
export function vmsUpload(body){
	return postImg(baseUrl+'api/vms/upload',body)
}

//保存投票活动
export function addVoteActivity(body){
	return postFile(baseUrl+'web/activity/add',body)
}

//投票内容详情
export function getModelRule(id){
	return fetch(baseUrl+'web/modelRule?id='+id)
}

//投票渠道配置详情
export function getPublishing(id){
	return fetch(baseUrl+'web-api/publishing/'+id)
}

//投票编辑提交
export function editActivityVote(id,body){
	return postFile(baseUrl+'web/activity/edit?id='+id,body)
}

//投票记录列表
export function voteRecordList(body){
	return fetch(baseUrl+'web-api/votes/record',body)
}

//投票数据
export function voteData(body){
	return fetch(baseUrl+'web/vote/getValidation',body)
}

//干预投票
export function interveneApi(body){
	return postJson(baseUrl+'web/vote/intervene',body)
}
